package com.ra.landlord;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 记录每次的Table改变，用于数据同步, 复合主键
 * 
 * @author Jerry
 *
 */
// @Entity
// @Table(name = "ra_tablechange")
public class TableLog {

	private Integer id;
	
	/**
	 * enum
		{
			EC_TABLE_TYPE_USER_ROOM_RELATION					= 1,			// user_room_relation表
			EC_TABLE_TYPE_SY_RENT_USER							= 2,			// sy_rent_user表
			EC_TABLE_TYPE_SYTBAGREEMENT							= 3,			// sytbAgreement表
			EC_TABLE_TYPE_SYTBFEE								= 4,			// sytbFee表
			EC_TABLE_TYPE_TBALLRELATION							= 5,			// tballrelation表
			EC_TABLE_TYPE_TBFEEADDITION							= 6,			// tbFeeAddition表
			EC_TABLE_TYPE_SYTBFEEITEM							= 7,			// sytbFeeItem表
			EC_TABLE_TYPE_SYTBFIGURATION						= 8,			// sytbFiguration表
			EC_TABLE_TYPE_SYTBMETER								= 9,			// sytbMeter表
			EC_TABLE_TYPE_SYTBWORKLOG							= 10,			// sytbWorklog表
			EC_TABLE_TYPE_ROOM_INFO								= 11,			// room_info表
			EC_TABLE_TYPE_TBFLOOR								= 12,			// tbFloor表
			EC_TABLE_TYPE_SY_BUILDINGS							= 13,			// sy_buildings表
			EC_TABLE_TYPE_AREA_INFO								= 14,			// area_info表
			EC_TABLE_TYPE_USERMODUBLESET_INFO					= 15,			// UserModuleSet表
			EC_TABLE_TYPE_SYTBFEEITEMDESC						= 16,			// sytbFeeItemDesc表
			EC_TABLE_TYPE_SYTBFEEITEMCALC						= 17,			// sytbFeeItemCalc表
			EC_TABLE_TYPE_TYPESPECIFICATION						= 18,			// type_specification表
			EC_TABLE_TYPE_SYTBNOTEBOOK							= 19,			// sytbnotebook表
			EC_TABLE_TYPE_SYTBNOTEBOOK_RELATION					= 20,			// synotebookrelation表
		};
	 */
	private Integer type;
	
	// 初始值为1， 每次加1
	private Integer version;
	
	private Date modifyOn;
	
	private LandlordOwnerUser landlordUser;

	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "tabletype")
	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	@Column(name = "version_id")
	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	@Column(name = "change_time")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getModifyOn() {
		return modifyOn;
	}

	public void setModifyOn(Date modifyOn) {
		this.modifyOn = modifyOn;
	}

	@ManyToOne
	@JoinColumn(name = "createuserid")
	public LandlordOwnerUser getLandlordUser() {
		return landlordUser;
	}

	public void setLandlordUser(LandlordOwnerUser landlordUser) {
		this.landlordUser = landlordUser;
	}
}
